//
//  CABaseAnimationViewController.m
//  iOSHeartAnimation
//
//  Created by ddy on 2018/7/26.
//  Copyright © 2018年 ddy. All rights reserved.
//

#import "CABaseAnimationViewController.h"
#import "CABaseAnimationAllViewController.h"
#import "CABaseAnimationTouchMoveViewController.h"
@interface CABaseAnimationViewController ()<UITableViewDelegate,UITableViewDataSource>
/** 动画数组 */
@property (nonatomic, strong) NSMutableArray  *animationArray;
/** tableView */
@property (nonatomic, strong) UITableView  *tableView;

@end
static NSString * const kcellID = @"CABaseAnimationUITableViewCell";
@implementation CABaseAnimationViewController
/** 动画数组 */
- (NSMutableArray *)animationArray{
    if(!_animationArray){
        _animationArray = [NSMutableArray arrayWithObjects:@"AnimationTouchMove",@"AnimationAll", nil];
    }
    return  _animationArray;
}
/** tableView */
- (UITableView *)tableView{
    if(!_tableView){
        _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return  _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //add tableView
    [self.view addSubview:self.tableView];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kcellID];
    
}
#pragma mark --- <UITableViewDelegate,UITableViewDataSource>
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.animationArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kcellID];
    cell.textLabel.text = self.animationArray[indexPath.row];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        CABaseAnimationTouchMoveViewController *touchVC = [CABaseAnimationTouchMoveViewController new];
        [self.navigationController pushViewController:touchVC animated:YES];
    } else if (indexPath.row == 1) {
        CABaseAnimationAllViewController *allVC = [CABaseAnimationAllViewController new];
        [self.navigationController pushViewController:allVC animated:YES];
    } 
}
@end
